<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
    <script src="./lib/babel.min.js"></script>
</head>
<body>
<div id="root">

</div>

</body>
<script type="text/babel">
    const root = ReactDOM.createRoot(document.querySelector("#root"));
    const obj = {
        a:1,
        b:"2",
        c:true,
        style:{
            color:"red"
        },
        className:"my"
    }
    // 如果要将对象下的属性依次传递给子组件可以使用其语法糖形式{...obj}
    const App = ()=>(
        <div>
            <h3>App</h3>
            <Child a={obj.a} b={obj.b} c={ obj.c} style={obj.style} className={obj.className}/>
            <hr/>
            <Child {...obj}/>
        </div>
    )
    const Child= props =>{
        // console.log(props);// {style:{color:"red"},className="my",a:1,b:"2",c:true}
        return (
            <div>
                <h3>Child</h3>
                <p>a:{props.a}</p>
                <p>b:{props.b}</p>
                <p>c:{props.c}</p>
                <p>className:{props.className}</p>
            </div>
        )
    }
    root.render(<App/>)
</script>
</html>